package com.thunisoft.incremental.common.util;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

import com.thunisoft.incremental.contrller.response.Response;
import com.thunisoft.incremental.contrller.response.SuccessResponse;

import lombok.experimental.UtilityClass;

/**
 * ControllerUtils
 *
 * @author Zhang Xin
 * @version v1.0
 * @since 2020/3/31 11:33
 */
@UtilityClass
public class ControllerUtils {

    public <T> ResponseEntity<Response> getEntity(T content, HttpStatus status){
        SuccessResponse<T> response = new SuccessResponse<>();
        response.setCode(status.getReasonPhrase());
        response.setContent(content);
        return new ResponseEntity<>(response,status);
    }
}
